import React, { Component, lazy ,Suspense} from 'react';
import { Route,Switch,Redirect } from 'react-router-dom';
var Home = lazy(()=>import('./Index/Home'))  //首页
var Service = lazy(()=>import('./Index/Service'))  //服务
var My = lazy(()=>import('./Index/My'))  //我的
var Tabbar= lazy(()=>import('../components/Tabbar'))


class Index extends Component {
    render() {
        return (
            <div className='index'>
                 <Suspense fallback={<div className='loading'><img src="https://hbimg.b0.upaiyun.com/942a62fe6eae0bdb9dd1f28940d7cf8c05e8c7ea29ed-Gg5396_fw658" alt="" /></div>}>
                    <Switch >
                        <Route exact path="/index/home" component={Home} />
                        <Route exact path="/index/service" component={Service} />
                        <Route exact path="/index/my" component={My} />
                        <Redirect exact from='/index' to="/index/home" />
                        {/* <Route path="/index/:id" component={Shop} />  */}
                        {/* <Route path="/index/*" component={NotFounds} /> */}
                    </Switch>
                </Suspense>
                <Tabbar />
            </div>
        );
    }
}

export default Index;